package cc.permission.repository;

import cc.permission.domain.User;
import cc.permission.infrastructure.UserTunnel;
import cc.permission.infrastructure.impl.UserMysqlTunnel;

import java.util.*;

/**
 * 用户查询类
 */
public class UserRepo {

    /**
     * Default constructor
     */
    public UserRepo() {
    }

    private UserTunnel userTunnel;

    /**
     * 根据用户组ID返回用户集合
     * @param id 用户组id
     * @return
     */
    public static List<User> queryByUserGroup(Integer id) {

        // TODO implement here
        return null;
    }

    public void add(User user){
        userTunnel = new UserMysqlTunnel();
        userTunnel.save(user);
    }

    public void update(User user){
        userTunnel = new UserMysqlTunnel();
        userTunnel.update(user);
    }

    public User get(int nid){
        userTunnel = new UserMysqlTunnel();
        return userTunnel.get(nid);
    }

}